package com.gxa.service.impl;

import com.gxa.domain.dto.OrderDto;
import com.gxa.domain.dto.SalegetData;
import com.gxa.domain.vo.Ordervo;
import com.gxa.mapper.SaleMapper;
import com.gxa.service.Saleservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SaleserviceImpl implements Saleservice {
    @Autowired
    private SaleMapper saleMapper;
    @Override
    public List<Integer> count(SalegetData salegetData) {
        // 实现统计逻辑
        if(salegetData.getType().equals("种类")){
            if (salegetData.getTime().equals("月")) {
                return saleMapper.countByTypeBymonth(salegetData);
            }else if (salegetData.getTime().equals("日")) {
                return saleMapper.countByTypeByday(salegetData);
            }
        }else if(salegetData.getType().equals("商品")){
            if (salegetData.getTime().equals("月")) {
                return saleMapper.countBygoodsBymonth(salegetData);
            }else if (salegetData.getTime().equals("日")) {
                return saleMapper.countBygoodsByday(salegetData);
            }
        }
        return null;
    }

    @Override
    public List<String> salefindByType() {
        return saleMapper.salefindByType();
    }

    @Override
    public List<String> salefindBygoods() {
        return saleMapper.salefindBygoods();
    }

    @Override
    public List<Ordervo> salefindByName(OrderDto orderDto) {
        return saleMapper.salefindByName(orderDto);
    }

    @Override
    public Integer allorder(OrderDto orderDto) {
        return saleMapper.allorder(orderDto);
    }

}
